/**
 * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.ddyx.service.user.api.feign;


import com.ddyx.common.base.constant.ServiceNameConstants;
import com.ddyx.service.user.api.feign.fallback.RemoteUserClientFallback;
import com.ddyx.service.user.api.vo.UserInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Feign是集成了Ribbon的，也就是说如果引入了Feign，那么Ribbon的功能也能使用，比如修改负载均衡策略等。
 * author: agula
 * since: 2019-07-31
 */
//values是服务提供方在eureka注册的名字，path是该接口中所有请求url的前缀
//@FeignClient(value = "ddyx-service-user", path = "/user")
@FeignClient(value = ServiceNameConstants.USER_SERVICE, fallback = RemoteUserClientFallback.class)
public interface RemoteUserClient {

	String API_PREFIX = "/user";

	/**
	 * 获取用户信息
	 *
	 * @param userId 用户id
	 * @return
	 */
	@GetMapping(API_PREFIX + "/user-info-by-id")
	UserInfo userInfo(@RequestParam("userId") Integer userId);

	/**
	 * 获取用户信息
	 *
	 * @param account    账号
	 * @param password   密码
	 * @return
	 */
	@GetMapping(API_PREFIX + "/user-info")
	UserInfo userInfo(@RequestParam("account") String account, @RequestParam("password") String password);

}
